package cn.eeepay.framework.service.impl.aatAgentActivity;

import cn.eeepay.framework.dao.aatAgentActivity.AppMenuActionDao;
import cn.eeepay.framework.db.pagination.Page;
import cn.eeepay.framework.model.aatAgentActivity.AppMenu;
import cn.eeepay.framework.service.aatAgentActivity.AppMenuActionService;
import cn.eeepay.framework.util.CommonUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("appMenuActionService")
public class AppMenuActionServiceImpl implements AppMenuActionService {

    @Resource
    private AppMenuActionDao appMenuActionDao;

    @Override
    public List<AppMenu> selectAllList(AppMenu info, Page<AppMenu> page) {
        List<AppMenu> list=appMenuActionDao.selectAllList(info,page);
        if(page.getResult()!=null&&page.getResult().size()>0){
            for(AppMenu item:list){
                item.setBtnIcon(CommonUtil.getImgUrlAgent(item.getBtnIcon()));
            }
        }
        return list;
    }

    @Override
    public int saveInfo(AppMenu info) {
        return appMenuActionDao.saveInfo(info);
    }

    @Override
    public int saveSwitch(int id, String sta) {
        return appMenuActionDao.saveSwitch(id,sta);
    }
}
